
var fnCustomAdd = function () {
    const_EditEntity = "salProvisionData";
    var pagetitle = "新增薪资计提";
    parent._employeeTitle = pagetitle;
    parent.addTabs(pagetitle, encodeURI("../Extend/Edit.aspx?r=" + Math.random() + "&entity=" + const_EditEntity));
    parent.NeedRefreshPage = this;
}

var fnCustomEdit = function () {
    var recordID = myDataTable.getSelectedRows()[0];
    record = myDataTable.getRecord(recordID);
    if (record == null) {
        alert("请选择一条记录");
        return;
    }
    const_EditEntity = "salProvisionData";
    var pagetitle = "修改薪资计提—" + record.getData("ProductName");
    parent._employeeTitle = pagetitle;
    parent.addTabs(pagetitle, encodeURI("../Extend/Edit.aspx?r=" + Math.random() + "&entity=" + const_EditEntity + "&id=" + record.getData(const_entityID)));
    parent.NeedRefreshPage = this;
}


var SelectPost = function () {
    setTimeout( $("#ProductName").val($("#ProdcutID").val()),50);
}


var _callBack = function (status) {
    //alert(FormulaData);
    if (status == 1) {
        var editwindow = document.getElementById("EditUIWindow");
        if (editwindow) {
           //alert( editwindow.contentWindow.getCondition());
        };
    }
}

var fnQueryRe = function (v) {
    $("#Condition").val(v);
}

if (typeof ($) != "undefined") {
    $(document).ready(function () {
        $("#btnSetCondition").click(function () { //设置表达式
            document.getElementById("EditUIWindow").src = "QueryForm.aspx?entity=V_CrmCommisionAll&flag=2&r=" + Math.random();
            setTimeout(function () {
                $("#dialogArea").fbmodal({
                    title: "公式设置",
                    cancel: "退出",
                    okay: "确定",
                    modal: true,
                    okaybutton: true,
                    cancelbutton: true,
                    buttons: true,
                    opacity: 0.0,
                    fadeout: true,
                    overlayclose: true,
                    modaltop: "15%",
                    modalwidth: "550",
                    modalheight: "270"
                }, _callBack);
            }, 100);
        });
    })
}




var fnGetRoles = function () {
    var entity = fnGetData("V_CrmCommisionRoleData", "");
    if (entity != null) {
        return entity.rows;
    }
    return null;
}

var ds_Detail_RoleName;
if (typeof ($) == "undefined") {
    ds_Detail_RoleName = fnGetRoles();
}